import uuid

from celery import shared_task
from django.core.mail import send_mail

from djangoProject import settings


@shared_task
def sendmail(uid, email, token):
    subject = 'celer异步激活测试'
    # 发送邮件验证激活

    path = 'http://127.0.0.1:8000/user_active?token={}'.format(token)

    message = '''
                    欢迎注册fruitoshop，成为我们的会员
                    请点击下面的链接激活您的账号！<br>  
                    <a href="{}">点击激活</a><br>
                    如果链接不可用可以复制到浏览器激活：{} <br>
                                    fruitoshop官方团队
                    '''.format(path, path)

    send_mail(subject=subject, message=message, from_email=settings.EMAIL_HOST_USER,
              recipient_list=[email, ], html_message=message)
